﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microhard.Core.DBUtility;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Runtime.Serialization;
using Microhard.Plat.CRM.Customers.Validator;


namespace Microhard.Plat.CRM.Customers.Models
{
    [FluentValidation.Attributes.Validator(typeof(OrderDetailValidator))]
    public class OrderDetailModelInServer : BasePermissionModel
    {
        [ModelPKID]
        public Guid OrderDetailID { set; get; }
        public string OrderCode { set; get; }
        [UIHint("SaleOrderRowTemp")]
        public string SKU { set; get; }
        [ReadOnly(true)]
        public string PrdName { set; get; }
        [DataType("Number")]
        public double OrderQty { set; get; }
        [DataType("Number")]
        public double ZPlanQty { set; get; }
        public string StoreNo { set; get; }
        public Guid OrderID { set; get; }
        public Guid PrdMapSaledID { set; get; }
        public Guid PrdID { set; get; }
        [DataType(DataType.Currency)]
        public decimal Price { set; get; }
        [ReadOnly(true)]
        public decimal Amount
        {
            get
            {
                return (decimal)this.OrderQty * this.Price;
            }
        }
        public DateTime CreateTime { set; get; }

        public OrderDetailModelInServer()
        {
            this.OrderQty = 1;
            this.Price = 1;
        }
    }
}
